Image Analyzer Batch Processing help


The Image Analyzer batch processing language is an extension of the math language used in the Expression evaluator (Help menu or F11). Below is a list of the extended commands. The command arguments correspond to the parameters you can choose in the Image Analyzer program.

To try the following batch processing programs, copy them from your browser and paste to the Process script window in Image Batch.

Image processing commands:
AdaptiveNoiseReduction(Strength,WindowSize)
AddText(X,Y,Text,Font,Size,#Color)
AutoColorCorrection(Saturation | Luminance | RGB)
AutoBlackWhitePoint
Deinterlace(Odd | Even,Level)
Invert
JPEGFilter
MakeGrayscale
Make8bit
Make24bit
MaxSize(MaxWidth,MaxHeight)
MedianFilter(WindowSize)
Mirror
Resize(Width,Height)
ResizeCanvas(Width,Height,X,Y,#Color)
Rotate(AngleDeg)
Sharpen
Smooth(Range)
Stamp(X,Y,FileName)

Output control commands:
SetJPEGQuality(Quality)
SetJPEGSizeLimit(ByteSize)
SetPNGQuality(Quality)
SetPNGFilter(MinSum | Runs | TryAll | None)
SetPluginOptions(OptionString)

Script flow control:
SkipNextIf(Condition)
goto(@Label)

Image defines:
Width, Height
BPP
FileName
InputFileSize
OutputFileSize


A script can be started from the command line, a .BAT file or a Windows shortcut by executing the batch processing program with the script name as argument, e.g.:
c:\Program Files\MeeSoft\ImageAnalyzer\ProcessingPlugins\ImageBatch script.bsc
When all images has been processed, the program will close.

Noise reduction and color correction

This program will apply the adaptive noise reduction filter with Image Analyzer's default parameters, and then do color correction:
AdaptiveNoiseReduction(20,3)
AutoColorCorrection(Saturation)

Reducing images to half size

Resize(round(Width/2),round(Height/2))

Generating thumbnails for web page

When presenting a large number of images on a website, it is often desirable to make a thumbnail preview of the images. This command will resize the images so that the size is max. 128 x 128 while preserving the height/width ratio.
MaxSize(128,128)
SetJPEGSizeLimit(8*kb)
Furthermore, the HTML code for presenting the images can be generated: If the Log string format is set to a string like

<A HREF="|f"><IMG SRC="thumbnails/|f" BORDER=0></A>

the program will generate the corresponding code in the log window which you can copy to your HTML editor:

<A HREF="PICT0001.JPG"><IMG SRC="thumbnails/PICT0001.JPG" BORDER=0></A>
<A HREF="PICT0002.JPG"><IMG SRC="thumbnails/PICT0002.JPG" BORDER=0></A>
<A HREF="PICT0003.JPG"><IMG SRC="thumbnails/PICT0003.JPG" BORDER=0></A>

Every occurrence of |f in the format string is replaced by the file name.


Limiting the size of compressed images to a specified number of bits

The following two programs will force the images to be compressed so that only 0.5 bits are used per pixel.

For JPEG output:     For JPEG 2000 output:
:MaxBitsPerPixel = 0.5
:Pixels = Width*Height
Pixels
:MaxBits = Pixels*MaxBitsPerPixel
MaxBits
SetJPEGSizeLimit(ceil(MaxBits/8))
:MaxBitsPerPixel = 0.5
SetPluginOptions("rate=" MaxBitsPerPixel/BPP)
These programs can also be used to compare the image quality of JPEG and JPEG 2000. For natural images, 0.5 bits per pixel is sufficient for JPEG 2000, whereas some artefacts are often visible in JPEG images.

Making loops

In the example above the file size was limited by reducing the image quality. Another way of producing smaller files is to reduce the image size. This program uses a loop to repeatedly half the image size until the file size is less than 60 kb.
@Retry
SkipNextIf(OutputFileSize>(60*kb))
  goto(@Done)
Resize(floor(Width/2),floor(Height/2))
goto(@Retry)

@Done

Rotate large images

This (probably quite useless) program will rotate all images with a width of 1000 pixels or above 90° clockwise:
SkipNextIf(Width<1000)
  Rotate(-90)

Adding text

To write text in the center of an image with the system font, use the command:
AddText(Center,Center,"Test!")
This next text example will add yellow text with a black shadow in the upper left corner. The text will be printed in bold Arial size 20:
AddText(11,11,"Test!",Arial Bold,20,#000000)
AddText(10,10,"Test!",Arial Bold,20,#F8AA07)
Numeric values can also be printed in the image. This program will write four lines of text with the image width, height and file size in kb before and after the recompression.
AddText(4,1*16,"File name: " FileName)
AddText(4,2*16,"Width: " Width)
AddText(4,3*16,"Height: " Height)
AddText(4,4*16,"Source file size: " round(InputFileSize/kb) " kb")
AddText(4,5*16,"New file size: " round(OutputFileSize/kb) " kb")

Adding a logo to the images

The Stamp command will place an image from a specified file in the images processed. If the the stamp image is in PNG format, transparency can be used.
Stamp(Center,8,"c:\graphics\logo.png")


 

meesoft.logicnet.dk         Last updated 2003-09-09 Michael Vinther